<template>
  <view>
    <!-- 确认签署，人脸弹出验证框 -->
    <uni-popup ref="faceDialog" type="dialog">
      <uni-popup-dialog type="info" title="系统提示" :showCancel="false" @confirm="finishSign" confirmText="点击人脸验证">
          <text>为确保是您本人操作，本次签署需要人脸核身验证！</text>
      </uni-popup-dialog>
    </uni-popup>
  </view>
</template>

<script>
import {EncryptCommon} from "../../api/login";

export default {
  data() {
    return {
      contractNumber:null,
    }
  },
  methods: {
    // 确认
    async finishSign() {
      // 生成二维码
      let verifyCode = Math.random() + "";
      let param = {};
      param.mobile = this.$store.getters.staffInfo.mobile;
      param.name = this.$store.getters.staffInfo.name;
      param.idNumber = this.$store.getters.staffInfo.idNumber;
      param.companyId = this.$store.getters.staffInfo.companyId;
      param.staffId = this.$store.getters.staffInfo.id;
      param.contractNumber = this.contractNumber;
      param.verifyCode = verifyCode;
      let data;
      // 加密参数
      await EncryptCommon(new Buffer(JSON.stringify(param)).toString('base64')).then((response) => {
        data = response;
      });
      this.$tab.navigateTo(`/pages/authentication/personal/facePersonal?verifyType=3&source=${this.contractNumber}&data=${data}`)
    },
    show(contractNumber) {
      this.contractNumber = contractNumber;
      // 若人脸校验成功 为空 则进行弹窗
      if (!uni.getStorageSync("signFace" + this.$store.getters.staffInfo.companyId + this.$store.getters.staffInfo.id + contractNumber)) {
        this.$refs.faceDialog.open()
      }
    },
    onClickItem(e) {

    },
  }
}
</script>

<style lang="scss" scoped>

.codeText {
  position: absolute;
  top: 16rpx;
  right: 20rpx;
  color: $uni-color-primary;
  font-size: 26rpx;
}

.flex_p {
  margin: 30rpx 0;
}

::v-deep .uni-dialog-content {
  display: block;
  padding: 10rpx 40rpx 60rpx 40rpx;
}

::v-deep .segmented-control {
  width: 100%;
}

::v-deep .uni-popup-dialog {
  width: 90%;
}

::v-deep .uni-dialog-title {
  padding: 30rpx;
}

::v-deep .uni-dialog-title-text {
  font-size: 30rpx;
}

</style>
